﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using 书易.DAL;
using 书易.Model;


namespace 书易.WEB.Admin
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Unnamed1_Click(object sender, EventArgs e)
        {

           
            string txtcode= txt_code.Text;
            
            if ((string)Session["code"]==null || Session["code"].ToString().ToLower()!= txtcode.ToLower()) {
                ClientScript.RegisterStartupScript(GetType(),"","alert('验证码错误')",true);
                return;
            }

             书易.Model.Admin a= AdminDal.selectAdmin(txt_name.Text, txt_pwd.Text);
             if (a != null)
             {
                 Session["admin"] = a;
                 Response.Redirect("index.aspx");
             }
             else {
                 ClientScript.RegisterStartupScript(GetType(), "", "alert('账号或密码错误')", true);
             }
        }
    }
}